﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using tiDE.API.Utility;
using System.Drawing;
using tiDE.KeyboardManager;

namespace tiDE.Settings
{
    [Serializable]
    public class GlobalSettings
    {
        #region Constructor

        public GlobalSettings()
        {
            RecentSolutions = new List<string>();
            CustomTools = new List<CustomTool>();
            BackgroundColor = Color.White;
            ShortcutManager = new ShortcutManager();
        }

        #endregion

        #region Appearance

        [SettingGroup("Appearance")]
        [SettingSubgroup("Editor")]
        [SettingName("Background Color")]
        [SettingDescription("The text editor's background color")]
        public Color BackgroundColor;

        [SettingGroup("Appearance")]
        [SettingSubgroup("Editor")]
        [SettingName("Font")]
        [SettingDescription("The font used for the text editor")]
        public Font Font;

        #endregion

        #region General
        [SettingGroup("General")]
        [SettingSubgroup("Start Page")]
        [SettingName("Display Cemetech Feed")]
        public bool DisplayCemetechFeed;

        [SettingGroup("General")]
        [SettingSubgroup("Start Page")]
        [SettingName("Display Omnimaga Feed")]
        public bool DisplayOmnimagaFeed;
        #endregion

        #region Emulator Settings

        [SettingGroup("Emulation")]
        [SettingValidator("ValidateDefaultEmulatorModel")]
        [SettingSubgroup("General")]
        [SettingName("Default Model")]
        [SettingDescription("The default calculator model to use for emulation within the TI-83+ Family")]
        [SettingOptionSet("TI-83+", "TI-83+ Silver Edition", "TI-84+", "TI-84+ Silver Edition")]
        [SettingEditor(SpecialEditorType.OptionSet)]
        public string DefaultModel;

        [SettingGroup("Emulation")]
        [SettingSubgroup("TI-83+")]
        [SettingEditor(SpecialEditorType.FileBrowse)]
        [SettingDescription("The TI-83+ ROM file to use for emulation")]
        [SettingName("ROM File")]
        [SettingFileBrowserFilter("ROM Files (*.rom)|*.rom")]
        public string ROM83Plus;

        #endregion

        #region Setting Validators

        public static SettingValidatorResponse ValidateDefaultEmulatorModel(object OldValue, object NewValue)
        {
            SettingValidatorResponse resp = new SettingValidatorResponse();
            resp.IsValid = false;
            resp.ValidationMessage = "Test message";
            return resp;
        }

        #endregion

        #region Hidden Settings

        [SettingHideFromView]
        public List<string> RecentSolutions;

        [SettingHideFromView]
        public List<CustomTool> CustomTools;

        [SettingHideFromView]
        public ShortcutManager ShortcutManager;

        [SettingHideFromView]
        public List<string> RegisteredAddIns;

        #endregion
    }
}
